< previous page page_483 next page >

Page 483
    '
    If Trim(varSelectValue) = "" Then
        CloseFlag = False
    End If
    '
    Me.Hide
    '
End Sub
Note that the CloseFlag is set along with the SelectedValue property. These property values are used by the control button you created earlier.
Finally, you need to add a bit of code to make the dialog box more user friendly. The code in Listing 12.23 executes when the user clicks or double-clicks the list. Add this to your project.
Type.gifListing 12.23. Coding the Click and DblClick events of the DBList control.
Private Sub DBList1_Click()
    '
    SelectedValue = DBList1.BoundText
    '
End Sub

Private Sub DBList1_DblClick()
    '
    Command1_Click 0
    '
End Sub
That's all the coding you need to complete the custom control. Now save the control and project. In the next section, you'll test the control in a sample data entry form.
Before you go to the next section, you should compile the dbFind.ocx control. This forces Visual Basic to review all the code and report any coding errors you may have in your project.
Testing the dbFind Custom Control
Now add a new Standard EXE project to the group (select File | Add Project . . . from the main menu). Use Table 12.3 and Figure 12.20 as guides when building the test form.

 
< previous page page_483 next page >

If you like this book, buy it!